#pragma once

#include "wlroots.hpp"

/* Basic size hints (subset of XSizeHints from X11) */
struct view_size_hints {
    int min_width;
    int min_height;
    int width_inc;
    int height_inc;
    int base_width;
    int base_height;
};

enum view_wants_focus {
    /* View does not want focus */
    VIEW_WANTS_FOCUS_NEVER = 0,
    /* View wants focus */
    VIEW_WANTS_FOCUS_ALWAYS,
    /*
     * View should be offered focus and may accept or decline
     * (a.k.a. ICCCM Globally Active input model). Labwc generally
     * avoids focusing these views automatically (e.g. when another
     * view on top is closed) but they may be focused by user action
     * (e.g. mouse click).
     */
    VIEW_WANTS_FOCUS_OFFER,
};


class View;

class ViewInterface
{
public:
    virtual void configure(struct wlr_box geo) = 0;
    virtual void close() = 0;
    virtual const char* get_string_prop(const char *prop) = 0;
    virtual void map() = 0;
    virtual void set_activated(struct wlr_surface *surface, bool activated) = 0;
    virtual void set_fullscreen(bool fullscreen) = 0;
    virtual void notify_tiled() = 0;
    /*
     * client_request is true if the client unmapped its own
     * surface; false if we are just minimizing the view. The two
     * cases are similar but have subtle differences (e.g., when
     * minimizing we don't destroy the foreign toplevel handle).
     */
    virtual void unmap(bool client_request) = 0;
    virtual void maximize(bool maximize) = 0;
    virtual void minimize(bool minimize) = 0;
    virtual void move_to_front() = 0;
    virtual void move_to_back() = 0;
    virtual struct View* get_root() = 0;
    virtual void append_children(struct wl_array *children) = 0;
    /* determines if view and surface are owned by the same process */
    virtual bool is_related(struct wlr_surface *surface) = 0;
    virtual struct view_size_hints get_size_hints() = 0;
    /* if not implemented, VIEW_WANTS_FOCUS_ALWAYS is assumed */
    virtual enum view_wants_focus wants_focus() = 0;
    /* returns true if view reserves space at screen edge */
    virtual bool has_strut_partial() = 0;

    virtual struct wlr_surface* surface_at(double vx, double vy,
                                           double* sx, double *sy) = 0;
    virtual struct wlr_box get_surface_geometry() = 0;
    virtual void resize(wlr_box geo) = 0;
    virtual void focus() = 0;
    virtual bool is_toplevel() = 0;
};
